<?php
/**
 * Created by PhpStorm.
 * User: Frings
 * Date: 2016/9/20
 * Time: 15:54
 */


use yii\helpers\Url;

$web = Url::base();
?>

<script type="application/javascript">
    $(function () {
        $("#is_enabled").bootstrapSwitch('state', true);
    });
</script>

<div class="form-horizontal" id="modaledit_detail_form">
    <div class="form-group" style=" margin-top: 5px">
        <label class="control-label col-lg-2" for="exampleInputPassword2">机构名称：</label>
        <div class="col-lg-10">
            <input type="text" id="institution_name" name="institution_name" class="form-control"
                   value="<?= $institution_name != null ? $institution_name : '' ?>">
        </div>
    </div>

    <div class="form-group" style=" margin-top: 5px">
        <label class="control-label col-lg-2" for="exampleInputPassword2">活动名称：</label>
        <div class="col-lg-10">
            <input type="text" id="name" name="name" class="form-control"
                   value="<?= $item != null ? $item['name'] : '' ?>">
        </div>
    </div>

    <div class="form-group" style=" margin-top: 5px">
        <label class="control-label col-lg-2" class="control-label" for="exampleInputPassword2">活动描述：</label>
        <div class="col-lg-10">
                <textarea id="description" name="description" class="form-control"
                          rows="3"><?= $item != null ? $item['description'] : '' ?></textarea>
        </div>
    </div>

    <div class="form-group" style=" margin-top: 5px">
        <label class="control-label col-lg-2" for="dtp_start_datetime">开始时间：</label>
        <div class="col-lg-4">
            <input type="text" id="start_datetime" name="start_datetime" class="form-control"
                   value="<?= $item != null ? $item['start_datetime'] : '' ?>">
        </div>
        <label class="control-label col-lg-2" for="exampleInputPassword2">结束时间：</label>
        <div class="col-lg-4">
            <input type="text" id="end_datetime" name="end_datetime" class="form-control"
                   value="<?= $item != null ? $item['end_datetime'] : '' ?>">
        </div>
    </div>

    <div class="form-group" style=" margin-top: 5px">
        <label class="control-label col-lg-2" for="exampleInputPassword2">是否启用：</label>
        <div class="col-lg-4">
            <div class="switch">
                <input type="checkbox" id="is_enabled" name="is_enabled" disabled="disabled"
                    <?php if ($item != null && $item['is_enabled'] == true) {
                        echo 'checked="checked"';
                    } ?>
                ><span
                    class="btn-clipboard popovers" data-trigger="hover"
                    data-placement="right"
                    data-content=""
                    data-original-title="提示"></span>
            </div>
        </div>
    </div>

    <div class="form-group" style=" margin-top: 3px;">
        <div class="col-lg-12">
            <table class="table table-bordered table-hover table-condensed">
                <thead class="nowrap">
                <tr>
                    <th class="col-lg-2">产品编码</th>
                    <th class="col-lg-6">产品名</th>
                    <th class="col-lg-2">原价</th>
                    <th class="col-lg-2">特价</th>
                    <th class="col-lg-2">首页显示</th>
                </tr>
                </thead>
                <tbody>
                <?php
                if ($goods != null && $goods != '') {
                    for ($i = 0; $i < count($goods); $i++) {
                        ?>
                        <tr>
                            <td><?= $goods[$i]['code'] ?></td>
                            <td><?= $goods[$i]['name'] ?></td>
                            <td><?= $goods[$i]['old_price'] ?></td>
                            <td><?= $goods[$i]['price'] ?></td>
                            <td>
                                <?php
                                if ($goods[$i]['is_top'] == 1) {
                                    echo ' <label class="label label-success">是</label>';
                                } else {
                                    echo ' <label class="label label-disable">否</label>';
                                }
                                ?>
                            </td>
                        </tr>
                        <?php
                    }
                }
                ?>
                </tbody>
            </table>
        </div>
    </div>
</div>